3 avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
5 date="2023-04-24T19:23:22Z"
7 hm, I didn't look inside `git` but `git diff` is likely to have it escaped because `patch` (and/or other unified diff operating tools) expect it such. In other words -- `git diff` must encode paths escaped because the \"diff standard\" expects it such.
9 On the other hand, as you confirmed, `git add` just displays the name on the screen, and as such it does not bother escaping it since may be I just cut/paste it as a string which is \"raw\" and thus not expecting any escape characters.
11 RTFMing [git-config on core.quotePath](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath) I spotted
13 > ... enclosing the pathname in double-quotes and escaping ...
15 so it talks about double-quotes. `git` `status`, `diff` report paths in double (`\"`) not single (`'`) quotes. I wonder if that is where/how `git` is consistent since in your example that is the difference too:
18 # current master git-annex
19 joey@darkstar:~/tmp/xxx>git-annex add 'gl\orious'
20 git-annex: \"gl\\orious\" not found
21 joey@darkstar:~/tmp/xxx>git add 'gl\orious'
22 fatal: pathspec 'gl\orious' did not match any files
25 that git uses `'` (and does not escape) while git annex uses `\"` (and escapes)? Did you see git doing escaping in paths where it reports them within single (`'`) quotes?
27 and thus git-annex should have just wrapped in `'` to become consistent with git in :
31 > git annex add --json --json-error-messages '\e[31mfo\o\e[0m'
32 git-annex: \e[31mfo\o\e[0m not found
34 > git add '\e[31mfo\o\e[0m'
35 fatal: pathspec '\e[31mfo\o\e[0m' did not match any files
36 > git rm '\e[31mfo\o\e[0m'
37 fatal: pathspec '\e[31mfo\o\e[0m' did not match any files